﻿// code03050400.cpp : 数组
// C风格字符串

#include <iostream>
#include <cstring>
using namespace std;

int main()
{
    char ca[] = { 'C','+','+' };
    cout << "ca的长度为" << strlen(ca) << endl;//报错！ca没有以空字符结尾

    //string类型间的比较
    string s1 = "A string example";
    string s2 = "A different string";
    if (s1<s2)          //false
    {
	    
    }

    //C风格字符串间的比较
    const char ca1[] = "A string example";
    const char ca2[] = "A different string";
    if (ca1<ca2)         //报错！指针间比较，无意义
    {
	    
    }

    if (strcmp(ca1,ca2)<0) //false   与string类型比较效果一致
    {
	    
    }
}


